package cn.school.controller.hotel;

import cn.school.common.api.CommonPage;
import cn.school.common.api.CommonResult;
import cn.school.hotel.entity.TripComment;
import cn.school.hotel.service.TripCommentService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "Hotel-Comment => 酒店评论")
@RequestMapping("/hotel/hotelComment")
public class HotelCommentController {

    @Autowired
    private TripCommentService tripCommentService;

    @ApiOperation("list => 分页查询酒店评论")
    @GetMapping(value = "/getHotelCommentPagelist")
    public CommonResult<CommonPage<TripComment>> getHotelCommentPagelist(TripComment tripComment,
                                                                         @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                         @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        IPage<TripComment> pageList = tripCommentService.getHotelCommentPagelist(tripComment,pageSize,pageNum);
        return CommonResult.success(CommonPage.restPage(pageList));
    }
}
